querier: limit number of blocks queried with one store-gateway request - #16292
Conversation
|
💻 Deploy preview deleted (Mimir). |
8d47850 to
821ed41
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 202e176. Configure here.
| // Concurrently fetch series from all clients. A client may have multiple partitions; each | ||
| // partition is one independent RPC to the same store-gateway. | ||
| for c, partitions := range clients { | ||
| for _, blockIDs := range partitions { |
There was a problem hiding this comment.
Note for the reviewers: the diffs here and below look scarier than what the changes did. We simply wrapped the loop over the list of blocks with a loop over block partitions. The body was just shifted one indentation level.
|
please rebase this PR on latest main, otherwise it can't merge — it's blocked on required checks that will never report. context: #16335 changed the unit test CI matrix and the required checks got renamed ( |
| storesQueried: promauto.With(reg).NewCounter(prometheus.CounterOpts{ | ||
| Name: "cortex_querier_storegateway_queried_total", | ||
| Help: "Total number of requests to store-gateway instances for a single query. Splitting queried blocks into partitions can produce more than one request per store-gateway instance per query.", | ||
| }), |
There was a problem hiding this comment.
Did you mean to make this a histogram? We won't get visibility at the request level with a counter. As it is, wouldn't this counter be ~the same (modulo retries) as cortex_storegateway_client_request_duration_seconds_count?
c9b9296 to
e70e114
Compare
e70e114 to
13b4433
Compare

What this PR does
The PR adds a new experimental per-tenant limit,
max_blocks_per_store_request(disabled by default), that controls how many blocks a single query can request from one store-gateway instance. If a request spills over the limit, this request is split into multiple partitions, each executed concurrently against the instance.For detailed rational see #16021
While testing the feature in a dev cell, I saw some improvement, and I believe it should be good for further testing.
Results from dev testing
Before (a request hinted 40 blocks to one store-gw instance)
After (the same request is split into several sub-requests, hinting up to 20 blocks from a store-gw instance)
On the store-gw side in this test, each request was bounded with up to 20
bucketBlock.ensurelndexHeaderLoadedcalls per request. The total number of concurrent requests, a store-gw instance accepts is limited by store-gw's global concurrency gate.Which issue(s) this PR fixes or relates to
Fixes #16021